﻿package com.mini.framework.bi.bpull.chart;

import java.util.List;

import com.mini.framework.bi.bpull.model.LineTrend;

public class LineTrendChart extends Chart{
	
	
	private String convertType = "average";
	
	
	
	private List<LineTrend> datas;

	public String getConvertType() {
		return convertType;
	}

	public void setConvertType(String convertType) {
		this.convertType = convertType;
	}

	

	public List<LineTrend> getDatas() {
		return datas;
	}

	public void setDatas(List<LineTrend> datas) {
		this.datas = datas;
	}
	
	public String getXml(){
		StringBuilder sb = new StringBuilder();
		sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
		sb.append("<data convertType=\""+this.getConvertType() +"\" ");
		if(this.getTag1() != null){
			sb.append("tag1=\""+this.getTag1()+"\" ");
		}
		if(this.getTag2() != null){
			sb.append("tag2=\""+this.getTag2()+"\" ");
		}
		if(this.getTag3() != null){
			sb.append("tag3=\""+this.getTag3()+"\"");
		}
		sb.append(">");
		System.out.println(this.getDatas()==null);
		System.out.println(this.getDatas().size());
		for(LineTrend line:datas){
			sb.append("<record overTag=\"" +line.getOverTag()+"\" xAxisTag=\"" +line.getXAxisTag()+"\" ");
			if(line.getData1() != null){
				sb.append("data1=\"" +line.getData1() +"\" ");
			}
			if(line.getData2() != null){
				sb.append("data2=\"" +line.getData2() +"\" ");
			}
			if(line.getData3() != null){
				sb.append("data3=\"" +line.getData3() +"\"");
			}
			sb.append("/>");
		}
		sb.append("</data>");
		return sb.toString();
	}
	
	

}
